<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout">
<head th:replace="dashboard/header :: header"></head>
<body>
	<div layout:fragment="content">
		<div class="container-fluid content-main">
			<div class="animated fadeIn">
				<div class="row">
					<!-- /.col-->
					<div class="col-sm-12">
						<div class="card">
							<div class="card-body">

								<form class="form-horizontal" id="modifyForm">

									<input type="hidden" name="formToken" th:value="${session.formToken}" />
									<input type="hidden" name="id" th:value="${bean.id}" />
									
									<div class="form-group row">
										<label class="col-md-2 col-form-label control-label" for="text-input">名称</label>
										<div class="col-md-9">
											<input class="form-control" id="text-input" type="text"
												name="applicationName" th:value="${bean.applicationName}" placeholder="应用名称">
										</div>
									</div>
									<div class="form-group row">
										<label class="col-md-2 col-form-label control-label" for="email-input">描述</label>
										<div class="col-md-9">
											<input class="form-control" id="email-input" type="text"
												name="applicationDesc" th:value="${bean.applicationDesc}" placeholder="应用描述">
										</div>
									</div>
									<div class="form-group row">
										<label class="col-md-2 col-form-label control-label" for="email-input">图标</label>
										<div class="col-md-9">
										
											<span class="form-control select-icons" id="applicationIconsLabel" readonly="readonly" onclick="showIcons()">
												<img th:src="${bean.applicationIcons}" style="width:60px" aria-hidden="true">
											</span>
											<span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 需要选择一个应用图标</span>
											<input type="hidden" id="applicationIcons" th:value="${bean.applicationIcons}" name="applicationIcons" />
										</div>
									</div>
									<div class="form-group row">
										<label class="col-md-2 col-form-label control-label" for="email-input">状态</label>
										<div class="col-md-9">
											<page:dict type="has_status" th:attr="value=${bean.hasStatus}" th:value="${bean.hasStatus}" name="hasStatus" />
										</div>
									</div>
								</form>

							</div>

							<!-- 
							<div class="card-footer">
								<button class="btn btn-primary" style="float: right"
									onclick="save()" type="button">保存</button>
							</div>
							-->

						</div>
					</div>
					<!-- /.col-->
				</div>
			</div>
		</div>

	</div>

	<footer th:replace="dashboard/footer :: footer"></footer>
	<script type="text/javascript" th:src="@{/resources/js/project.js}"></script>

	<script type="text/javascript">
	
		var addForm = $("#modifyForm") ; 
		
		$(function(){
			var icon = "<i class='fa fa-times-circle'></i> ";
			modifyForm.validate({
				ignore: [],  
				rules: {
					applicationName: "required",
					applicationDesc: "required",
					applicationIcons: "required"
				}
			});
		}) ;
			
		function submitHandler() {
			var result = $.validate.form("modifyForm");
			if(result){
				$.operate.save(ctx+"portal/ucenter/project/update" , $('#modifyForm').serialize());
			}
	    }

	</script>

</body>
</html>
